home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
MiniExamples
/
AppKit
/
CellScrollView
/
FooCell.m
< prev
next >
Wrap
Text File
|
1993-06-22
|
1KB
|
73 lines
/*
* You may freely copy, distribute, and reuse the code in this example.
* NeXT disclaims any warranty of any kind, expressed or implied, as to its
* fitness for any particular use.
*/
#import "FooCell.h"
#import "FooObject.h"
#import <dpsclient/psops.h>
#import <objc/hashtable.h>
#import <stdlib.h>
#import <stdio.h>
#define FIELD1_LMARGIN 4.0
#define FIELD2_LMARGIN 54.0
@implementation FooCell
- init
{
[super init];
[self setType:NX_TEXTCELL];
return self;
}
- fooObject
{
return fooObject;
}
- setFooObject:anObject
{
fooObject = anObject;
return self;
}
- setFont:fontObj
{
[super setFont:fontObj];
/*
* save this info so we don't have to look it up every time we draw
* Note: support for a TextCell is a font object
*/
NXTextFontInfo(support, &ascender, &descender, &lineHeight);
return self;
}
- drawInside:(const NXRect *)cellFrame inView:controlView
{
char buf[100];
NXCoord baseX, baseY;
baseX = NX_X(cellFrame);
baseY = NX_Y(cellFrame) + lineHeight - descender;
/* erase the cell */
PSsetgray((cFlags1.state || cFlags1.highlighted) ? NX_WHITE : NX_LTGRAY);
NXRectFill(cellFrame);
PSsetgray(NX_BLACK);
/* draw the start, duration, and mark name in black */
PSmoveto(baseX + FIELD1_LMARGIN, baseY);
sprintf(buf,"%d",[fooObject intValue]);
PSshow(buf);
PSmoveto(baseX + FIELD2_LMARGIN, baseY);
PSshow("xyzzy");
return self;
}
@end